/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/10 12:38
  *
  * @file       hd_oled_protocol_spi.h
  * @brief      Head file of OLED SPI Communication Protocol Hardware Driver.
  *
  * @note       This file contains the SPI Communication Protocol hardware
  *             driver's function declaration for the OLED.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date           Author       Notes
  *   2024/6/10      Chris        the first version
  *
  ******************************************************************************
  */

#ifndef OLED_PROTOCOL_SPI_H
#define OLED_PROTOCOL_SPI_H

#include "pd_gpio.h"
#include "pd_spi.h"
#include "hd_oled_protocol.h"
#include "drivers.h"

typedef struct OLEDProtocolSPIDef OLEDProtocolSPI;

/* extends {@link OLEDProtocol} */
struct OLEDProtocolSPIDef {
    OLEDProtocol oledProtocol;
    SPI *spi;

    GPIO *res;   /* reset                    */
    GPIO *dc;    /* data type: data or cmd   */
    GPIO *cs;    /* chip select              */
};

extern const struct OLEDProtocolSPIClass {
    OLEDProtocolSPI *(*build)(SPI *spi, GPIO *res, GPIO *dc, GPIO *cs);
} OLEDProtocolSPIBuilder;

#endif // OLED_PROTOCOL_SPI_H
